In various interface devices, such as keypads, joysticks, wheels, gamepads, etc., detection of user selections of differing buttons and switches is needed. A standard switch matrix operates like a grid of horizontal and vertical conductors. At all points where the horizontal and vertical conductors cross, a switch is located. Pressing/closing the switch connects the two conductors. FIG. 1 presents a functional diagram of a standard matrix 8 of sixteen (16) switches, a 4×4 matrix. In the standard 16 switch matrix, four of the conductors or row lines, Row 0, Row 1, Row 2, and Row 3, are dedicated to drive a voltage corresponding to a logic level zero into the matrix. Only one of the four rows is driven low at a time, and the remaining rows are passively pulled high by the pull-up resistors 10a, 10b, 10c, or 10d on the top of the matrix. Four lines, Column 0, Column 1, Column 2, and Column 3, act as scan lines and are used to read back the state of the matrix. The row that is being scanned is the one that is at logic zero. The matrix is read by sampling the column conductors. For example, in the representation of FIG. 1, closed switches are indicated by circles and open switches are indicated by a cluster of dots. Thus, one switch, switch 14bc, is shown as closed. When Row 1 is driven low during a scan of the matrix, Column 2 reads zero, which indicates to a processor 12 driving the rows and performing the scan that the switch 14bc corresponding to Row 1 and Column 2 is closed/pressed.
In certain situations, a problem with a switch falsely being interpreted as closed can arise. FIG. 2 illustrates the closing/pressing of three switches, switch 14bb, switch 14cb, and switch 14cc, within the functional switch matrix diagram of FIG. 1. Row 1 is driven low by the processor 12 in order to determine if any of the switches on Row 1 are pressed. Because switch 14bb is pressed, Column 1 is connected to Row 1 and Column 1 is forced low. The processor 12 then correctly detects that the switch 14bb at the intersection of Row 1 and Column 1 is pressed. Because Column 1 is low, and switch 14cb is also pressed, Row 2 is also connected to Row 1 through Column 1. This connection pulls Row 2 low. Since button switch 14cc on Row 2 is also pressed, Column 2 is likewise pulled low. Since the processor 12 is driving Row 1 low, it interprets the low on Column 2 as though the switch 14bc were closed, as indicated by the triangles in FIG. 2. In this way, the switch 14bc is falsely interpreted as closed and is said to “ghost” the switch 14cc. In order to avoid such “ghosting”, normally the design of a matrix solution must achieve the ability to properly identify closed switches while accounting for and overcoming the problem of “ghosting.” In general, for the standard matrix diagram as shown in FIGS. 1 and 2, allowing only one of the scanning rows to be in the unique low state avoids the ghosting problem.
FIG. 3 illustrates a conventional standard 4×4 switch matrix 20 for switch selection that avoids ghosting. As shown, there are 16 switches, S1 through S16, and 16 diodes, D1 through D16. The diodes act as one-way valves, which allow electrons to flow through the switches in only one direction, i.e., from higher voltage (logic 1) to lower voltage (logic 0) in a conventional circuit. The diodes further act to avoid a short circuit that could exist by pressing any two switches in the same column, which would draw too much current from the processor 12 driving the output lines.
The diodes in the standard switch matrix also act to overcome the ghosting problem. In the example of FIG. 3, switch S6 is shown as closed. When ROW1 is driven low by the processor 22, diode D6 allows current to flow through S6, which pulls COL2 low. Note in the schematic, the diodes allow a row that is low (being scanned) to pull a column low. But, should a second switch be pressed within a column, such as switch S10, diode D10 prevents the low voltage on COL2 from pulling ROW2 low, since the diode D10 is reverse-biased (i.e., the side of the diode that the arrow is pointing to is at a higher voltage (+5V) thanthe opposite side of the diode (0V)). Since a reverse-biased diode will not conduct, only the row being driven low by the processor 22 will be low, and no other row will be pulled low, even if more than one switch in a column is pressed. In this manner, the ghosting problem, as described with reference to FIG. 2, will not occur.
While the conventional switch matrix can provide switch selection indication and avoid ghosting, the conventional approach is input/output (I/O) intensive, requiring significant processor resources in providing scan line processing. The conventional switch matrix further requires one diode per switch to prevent ghosting, which adds considerable accumulative cost as the number of switches within a matrix grows. Accordingly, what is needed is a switch matrix that is more efficient and has a lower cost than the conventional switch matrix.